home *** CD-ROM | disk | FTP | other *** search
/ CyberMycha 2008 January / Cybermycha 1_2008.iso / Data.cab / _078D6A2B8988436591FBEEAD5F74B4D1 < prev    next >
Encoding:
Text File  |  2004-04-29  |  1.1 KB  |  64 lines

  1.  
  2. regc(0, "COMBINED_XFORM")
  3. regc(4, "MODEL_XFORM")
  4.  
  5. regc(12, "FOG_PARAMS")
  6. regc(13, "CAMERA_POS_MS")
  7.  
  8. regc(14, "TEXTURE1_XFORM")
  9. regc(18, "TEXTURE2_XFORM")
  10.  
  11. vshader("
  12.  
  13. #define point        v0
  14. #define normal        v1
  15. #define tangent        v2
  16. #define tcoord        v3
  17.  
  18. #define fogp    c12
  19. #define camp    c13
  20.  
  21.     vs_1_1
  22.  
  23. #include    <cardef.h>
  24. #include    <fog.inc>
  25.  
  26.     dcl_position    point
  27.     dcl_normal        normal
  28.     dcl_tangent        tangent
  29.     dcl_texcoord    tcoord
  30.  
  31.     def    c24, 1, 0, 0, GLASSFRESNELSCALE
  32.  
  33.  
  34.     ; output position
  35.     m4x4    oPos, point, c0
  36.  
  37.     sub    r0, camp, point
  38.       ; fresnel
  39.     dp3 r6.w, r0, r0
  40.     rsq r6.w, r6.w
  41.     mul r6.xyz, r0, r6.w
  42.  
  43.     dp3    r6.w, r6, normal
  44.     mad r6.w, r6.w, -r6.w, c24.x  // -dot(E, N)*dot(E, N)+1 = 1- pow(dot(E, N),2)
  45.     mul    r6.w, r6.w, r6.w        //f^2
  46.     ; output fresnel
  47.     mul oD0, r6.w, c24.w
  48.  
  49.     dp3    r1.w, r0, normal
  50.     add    r1.w, r1.w, r1.w
  51.     mad    r0, r1.w, normal, -r0
  52.  
  53.         m3x3    oT1, -normal, c14
  54.         m3x3    oT2, -r0, c18
  55.  
  56.     ; output texcoords
  57.     mov    oT0, tcoord           // color
  58.  
  59.     ; calc fog
  60.        dp4    r0.x, point, c2
  61.        FOG(r0.x, fogp, r10)
  62. ")
  63.  
  64.